﻿using System;
using OME;

namespace EquityMatchingEngine
{
    class OMEHost
    {
        [STAThread]
        static void Main(string[] args)
        {
            BizDomain equityDomain;
            //Create equity domain with 3 order processor dedicated to process
            //MSFT, IBM and GE orders
            string [] services = { "TRAN", "LEGL", "WELL", "ADMN", "HEAL", "UTIL", "SECR", "FIRE" };
            equityDomain = new BizDomain("Equity Domain", services);
            //Assign the order ranking logic
            equityDomain.OrderBook.OrderPriority = new PriceTimePriority();
            //Assign the business component
            EquityMatchingLogic equityMatchingLogic = new EquityMatchingLogic(equityDomain);
            equityDomain.logic = equityMatchingLogic;
            //Start the matching engine
            equityDomain.Start();

            

            //equityDomain.SubmitOrder("TRAN", new OME.Storage.ServiceOrder("TRDR", "TRAN", "MARKET", "B", 0.01, 100));
            //equityDomain.SubmitOrder("TRAN", new OME.Storage.ServiceOrder("TRDR", "TRAN", "MARKET", "S", 0.01, 90));
            //TradingClient client = new TradingClient(equityDomain, trader);
            //client.Start();


            //equityDomain.SubmitOrder("TRAN", new OME.Storage.ServiceOrder("TRDR", "TRAN", "MARKET", "B", 0.01, 100));
            //Submit buy order
            //equityDomain.SubmitOrder("TRAN", new ServiceOrder("TRAN", "MARKET", "B", 0.01, 100));
            //Submit sell order
            //this will also generate a trade because 
            //there is a matching counter buy order
            //equityDomain.SubmitOrder("TRAN", new OME.Storage.ServiceOrder("TRDR", "TRAN", "MARKET", "S", 0.01, 90));

            Console.WriteLine("Press any key to Stop");
            Console.ReadLine();
        }
    }
}
